package com.example.springcloudwinter.controller;

import com.example.springcloudwinter.dto.ResultEntity;
import com.example.springcloudwinter.service.BusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.*;

@RefreshScope
@RestController
@RequestMapping("/business")
public class BusinessController {
    @Autowired
    private BusinessService businessService;
    
    @GetMapping("")
    public ResultEntity<?> listBusinessByOrderTypeId(@RequestParam(value = "orderTypeId" ,required = false,defaultValue = "0")int orderId){
        return businessService.getListByCategory(orderId);
    }
    
    @GetMapping("/info/{businessId}")
    public ResultEntity<?> getBusinessById(@PathVariable("businessId")int businessId){
        return businessService.getDetailedInformation(businessId);
    }
}